From 60e1b3ea89c6103cd5b000758721cda1a6a3db76 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Tue, 24 Jun 2008 10:22:40 +0000 Subject: [PATCH] Remove container implementation, which isn't thought for handling 2008-06-24 Carlos Garnacho * gtk/gtkdialog.[ch]: Remove container implementation, which isn't thought for handling non-direct children. Fixes #539732. (gtk_dialog_pack_start) (gtk_dialog_pack_end): Removed as well, it doesn't provide enough control to API users (removing, reordering...), this is better handled through: (gtk_dialog_get_content_area): New function which just returns dialog->vbox. * gtk/gtk.symbols: Modify accordingly. * docs/reference/gtk/tmpl/gtkdialog.sgml: Update docs to recommend using gtk_dialog_get_[action|content]_area() instead of accessing dialog struct members directly. svn path=/trunk/; revision=20680 --- ChangeLog | 14 +++++ docs/reference/gtk/tmpl/gtkdialog.sgml | 11 ++-- gtk/gtk.symbols | 3 +- gtk/gtkdialog.c | 82 +++----------------------- gtk/gtkdialog.h | 13 +--- 5 files changed, 29 insertions(+), 94 deletions(-) diff --git a/ChangeLog b/ChangeLog index bf4e03357d..9d5d759ec1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2008-06-24 Carlos Garnacho + + * gtk/gtkdialog.[ch]: Remove container implementation, which isn't + thought for handling non-direct children. Fixes #539732. + (gtk_dialog_pack_start) (gtk_dialog_pack_end): Removed as well, it + doesn't provide enough control to API users (removing, reordering...), + this is better handled through: + (gtk_dialog_get_content_area): New function which just returns + dialog->vbox. + * gtk/gtk.symbols: Modify accordingly. + * docs/reference/gtk/tmpl/gtkdialog.sgml: Update docs to recommend + using gtk_dialog_get_[action|content]_area() instead of accessing + dialog struct members directly. + 2008-06-24 Michael Natterer * gtk/gtkassistant.h diff --git a/docs/reference/gtk/tmpl/gtkdialog.sgml b/docs/reference/gtk/tmpl/gtkdialog.sgml index b6efb0c792..1cbb836720 100644 --- a/docs/reference/gtk/tmpl/gtkdialog.sgml +++ b/docs/reference/gtk/tmpl/gtkdialog.sgml @@ -30,9 +30,8 @@ buttons. If 'dialog' is a newly created dialog, the two primary areas of the window -can be accessed as GTK_DIALOG(dialog)->vbox and -GTK_DIALOG(dialog)->action_area, -as can be seen from the example, below. +can be accessed through gtk_dialog_get_content_area() and +gtk_dialog_get_action_area(), as can be seen from the example, below. @@ -74,7 +73,7 @@ dialog contents manually if you had more than a simple message in the dialog. void quick_message (gchar *message) { - GtkWidget *dialog, *label; + GtkWidget *dialog, *label, *content_area; /* Create the widgets */ @@ -84,6 +83,7 @@ void quick_message (gchar *message) { GTK_STOCK_OK, GTK_RESPONSE_NONE, NULL); + content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); label = gtk_label_new (message); /* Ensure that the dialog box is destroyed when the user responds. */ @@ -95,8 +95,7 @@ void quick_message (gchar *message) { /* Add the label, and show everything we've added to the dialog. */ - gtk_container_add (GTK_CONTAINER (GTK_DIALOG(dialog)->vbox), - label); + gtk_container_add (GTK_CONTAINER (content_area), label); gtk_widget_show_all (dialog); } diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols index 5ed7d203db..a83d1f8fe6 100644 --- a/gtk/gtk.symbols +++ b/gtk/gtk.symbols @@ -1045,13 +1045,12 @@ gtk_dialog_add_action_widget gtk_dialog_add_button gtk_dialog_add_buttons G_GNUC_NULL_TERMINATED gtk_dialog_get_action_area +gtk_dialog_get_content_area gtk_dialog_get_has_separator gtk_dialog_get_response_for_widget gtk_dialog_get_type G_GNUC_CONST gtk_dialog_new gtk_dialog_new_with_buttons -gtk_dialog_pack_end -gtk_dialog_pack_start gtk_dialog_response gtk_dialog_run gtk_alternative_dialog_button_order diff --git a/gtk/gtkdialog.c b/gtk/gtkdialog.c index 969026458b..45471fad40 100644 --- a/gtk/gtkdialog.c +++ b/gtk/gtkdialog.c @@ -77,11 +77,6 @@ static void gtk_dialog_map (GtkWidget *widget); static void gtk_dialog_close (GtkDialog *dialog); -static void gtk_dialog_add (GtkContainer *container, - GtkWidget *widget); -static void gtk_dialog_remove (GtkContainer *container, - GtkWidget *widget); - static ResponseData* get_response_data (GtkWidget *widget, gboolean create); static void gtk_dialog_buildable_interface_init (GtkBuildableIface *iface); @@ -123,18 +118,13 @@ gtk_dialog_class_init (GtkDialogClass *class) { GObjectClass *gobject_class; GtkWidgetClass *widget_class; - GtkContainerClass *container_class; GtkBindingSet *binding_set; gobject_class = G_OBJECT_CLASS (class); widget_class = GTK_WIDGET_CLASS (class); - container_class = GTK_CONTAINER_CLASS (class); gobject_class->set_property = gtk_dialog_set_property; gobject_class->get_property = gtk_dialog_get_property; - - container_class->add = gtk_dialog_add; - container_class->remove = gtk_dialog_remove; widget_class->map = gtk_dialog_map; widget_class->style_set = gtk_dialog_style_set; @@ -362,28 +352,6 @@ gtk_dialog_get_property (GObject *object, } } -static void -gtk_dialog_add (GtkContainer *container, - GtkWidget *widget) -{ - GtkDialog *dialog; - - dialog = GTK_DIALOG (container); - - gtk_box_pack_start (GTK_BOX (dialog->vbox), widget, FALSE, FALSE, 0); -} - -static void -gtk_dialog_remove (GtkContainer *container, - GtkWidget *widget) -{ - GtkDialog *dialog; - - dialog = GTK_DIALOG (container); - - gtk_container_remove (GTK_CONTAINER (dialog->vbox), widget); -} - static gint gtk_dialog_delete_event_handler (GtkWidget *widget, GdkEventAny *event, @@ -1498,57 +1466,21 @@ gtk_dialog_get_action_area (GtkDialog *dialog) } /** - * gtk_dialog_pack_start: + * gtk_dialog_get_content_area: * @dialog: a #GtkDialog - * @widget: #GtkWidget to be added to @dialog. - * @expand: %TRUE if @widget should take all extra space. - * @fill: %TRUE if all space given should be used by @widget - * @padding: extra pixels to put between @widget and its neighbors * - * This function similar to gtk_box_pack_start() packs @widget - * with reference to the start of @dialog. + * Returns the content area of @dialog. * - * Since: 2.14 - **/ -void -gtk_dialog_pack_start (GtkDialog *dialog, - GtkWidget *widget, - gboolean expand, - gboolean fill, - guint padding) -{ - g_return_if_fail (GTK_IS_DIALOG (dialog)); - g_return_if_fail (GTK_IS_WIDGET (widget)); - - gtk_box_pack_start (GTK_BOX (dialog->vbox), - widget, expand, fill, padding); -} - -/** - * gtk_dialog_pack_end: - * @dialog: a #GtkDialog - * @widget: #GtkWidget to be added to @dialog. - * @expand: %TRUE if @widget should take all extra space. - * @fill: %TRUE if all space given should be used by @widget - * @padding: extra pixels to put between @widget and its neighbors - * - * This function similar to gtk_box_pack_end() packs @widget - * with reference to the end of @dialog. + * Returns: the content area #GtkVBox. * * Since: 2.14 **/ -void -gtk_dialog_pack_end (GtkDialog *dialog, - GtkWidget *widget, - gboolean expand, - gboolean fill, - guint padding) +GtkWidget * +gtk_dialog_get_content_area (GtkDialog *dialog) { - g_return_if_fail (GTK_IS_DIALOG (dialog)); - g_return_if_fail (GTK_IS_WIDGET (widget)); + g_return_val_if_fail (GTK_IS_DIALOG (dialog), NULL); - gtk_box_pack_end (GTK_BOX (dialog->vbox), - widget, expand, fill, padding); + return dialog->vbox; } #define __GTK_DIALOG_C__ diff --git a/gtk/gtkdialog.h b/gtk/gtkdialog.h index f25311ecfe..5cc1841b87 100644 --- a/gtk/gtkdialog.h +++ b/gtk/gtkdialog.h @@ -171,17 +171,8 @@ void gtk_dialog_response (GtkDialog *dialog, /* Returns response_id */ gint gtk_dialog_run (GtkDialog *dialog); -GtkWidget * gtk_dialog_get_action_area (GtkDialog *dialog); -void gtk_dialog_pack_start (GtkDialog *dialog, - GtkWidget *widget, - gboolean expand, - gboolean fill, - guint padding); -void gtk_dialog_pack_end (GtkDialog *dialog, - GtkWidget *widget, - gboolean expand, - gboolean fill, - guint padding); +GtkWidget * gtk_dialog_get_action_area (GtkDialog *dialog); +GtkWidget * gtk_dialog_get_content_area (GtkDialog *dialog); /* For private use only */ void _gtk_dialog_set_ignore_separator (GtkDialog *dialog, -- 2.30.2